package com.shenhan.lock;


/**
 * @Author shenhan
 * @Date: 2020/6/13 12:47
 * @Description:
 */
public class Demo {
    public static void main(String[] args) {
        Phone phone = new Phone();
        new Thread(phone::sms, "A").start();
        new Thread(phone::sms, "B").start();
    }
}

class Phone {
    public synchronized void sms() {
        System.out.println(Thread.currentThread().getName() + "smc");
        call();
    }

    public synchronized void call() {
        System.out.println(Thread.currentThread().getName() + "call");
    }
}
